using System;

namespace ASPNETVN.PORTAL.Components.Configuration.Items
{
    public class Module
    {
        public static Module LoadModuleRow(ASPNETVN.PORTAL.PortalDataSet.ModuleRow moduleRow)
        {
            Module module = new Module();
            module.ShowEveryWhere = moduleRow.ShowEveryWhere;
            module.Title = moduleRow.Title;
            module.ID = moduleRow.ID;
            module.ModuleDefinitionID = moduleRow.ModuleDefinitionID;
            module.SortOrder = moduleRow.SortOrder;
            module.TabID = moduleRow.TabID;
            module.PaneName = moduleRow.PaneName;
            module.AuthorizedViewRoles = moduleRow.AuthorizedViewRoles;
            module.AuthorizedAddRoles = moduleRow.AuthorizedAddRoles;
            module.AuthorizedEditRoles = moduleRow.AuthorizedEditRoles;
            module.AuthorizedDeleteRoles = moduleRow.AuthorizedDeleteRoles;
            module.AuthorizedApproveRoles = moduleRow.AuthorizedApproveRoles;
            module.AuthorizedConfigureRoles = moduleRow.AuthorizedConfigureRoles;
            module.AuthorizedManageRoles = moduleRow.AuthorizedManageRoles;
            module.AuthorizedSecureRoles = moduleRow.AuthorizedSecureRoles;
            module.CacheTimeOut = moduleRow.CacheTimeout;

            // ModuleDefinition data.
            module.SourceFile = moduleRow.ModuleDefinitionRow.SourceFile;
            return module;
        }

        private string _AuthorizedViewRoles = "-1";
        private string _AuthorizedAddRoles = "1";
        private string _AuthorizedEditRoles = "1";        
        private string _AuthorizedDeleteRoles = "1";
        private string _AuthorizedApproveRoles = "1";
        private string _AuthorizedConfigureRoles = "1";
        private string _AuthorizedManageRoles = "1";
        private string _AuthorizedSecureRoles = "1";

        private int _CacheTimeOut;
        private Guid _ID;
        private Guid _ModuleDefinitionID;
        private int _SortOrder;
        private string _PaneName;
        private bool _ShowEveryWhere;
        private string _SourceFile;
        private Guid _TabID;
        private string _Title;

        public int SortOrder
        {
            get { return this._SortOrder; }
            set { this._SortOrder = value; }
        }

        public bool ShowEveryWhere
        {
            get { return this._ShowEveryWhere; }
            set { this._ShowEveryWhere = value; }
        }

        public string Title
        {
            get { return this._Title; }
            set { this._Title = value; }
        }

        public string PaneName
        {
            get { return this._PaneName; }
            set { this._PaneName = value; }
        }

        public Guid ID
        {
            get { return this._ID; }
            set { this._ID = value; }
        }

        public Guid ModuleDefinitionID
        {
            get { return this._ModuleDefinitionID; }
            set { this._ModuleDefinitionID = value; }
        }

        public int CacheTimeOut
        {
            get { return this._CacheTimeOut; }
            set { this._CacheTimeOut = value; }
        }

        public string AuthorizedAddRoles
        {
            get { return this._AuthorizedAddRoles; }
            set { this._AuthorizedAddRoles = value; }
        }

        public string AuthorizedEditRoles
        {
            get { return this._AuthorizedEditRoles; }
            set { this._AuthorizedEditRoles = value; }
        }

        public string AuthorizedViewRoles
        {
            get { return this._AuthorizedViewRoles; }
            set { this._AuthorizedViewRoles = value; }
        }

        public Guid TabID
        {
            get { return this._TabID; }
            set { this._TabID = value; }
        }

        public string SourceFile
        {
            get { return this._SourceFile; }
            set { this._SourceFile = value; }
        }

        public string AuthorizedDeleteRoles
        {
            get { return this._AuthorizedDeleteRoles; }
            set { this._AuthorizedDeleteRoles = value; }
        }

        public string AuthorizedApproveRoles
        {
            get { return _AuthorizedApproveRoles; }
            set { _AuthorizedApproveRoles = value; }
        }

        public string AuthorizedConfigureRoles
        {
            get { return _AuthorizedConfigureRoles; }
            set { _AuthorizedConfigureRoles = value; }
        }

        public string AuthorizedManageRoles
        {
            get { return _AuthorizedManageRoles; }
            set { _AuthorizedManageRoles = value; }
        }

        public string AuthorizedSecureRoles
        {
            get { return _AuthorizedSecureRoles; }
            set { _AuthorizedSecureRoles = value; }
        }
    }
}